{% include 'admin/header.html' %}

<body>
  <div class="lyear-layout-web">
    <div class="lyear-layout-container">
      {% include 'admin/nav.html' %}

      <main class="lyear-layout-content">
        <div class="container-fluid">
          <!-- 提示信息 -->
          <div class="alert alert-info" role="alert">
            请根据需求编辑管理员信息。用户名和管理员名称是必填项，密码修改可选。
          </div>

          <!-- 卡片标题部分 -->
          <div class="card shadow-sm">
            <header class="card-header d-flex justify-content-between align-items-center">
              <h4 class="card-title mb-0 text-primary">编辑管理员</h4>
              <div>
                <a href="{{ url_for('main.admin_user_management') }}" class="btn btn-outline-primary btn-sm">返回管理员列表</a>
              </div>
            </header>

            <!-- 卡片内容 -->
            <div class="card-body">
              <form action="{{ url_for('main.admin_user_edit', id=admin.id) }}" method="POST">
                <!-- 用户名 -->
                <div class="form-group mb-3">
                  <label for="name" class="form-label">用户名</label>
                  <input type="text" id="name" name="name" class="form-control" value="{{ admin.name }}" required placeholder="请输入用户名">
                </div>

                <!-- 管理员名称 -->
                <div class="form-group mb-3">
                  <label for="admin_name" class="form-label">管理员名称</label>
                  <input type="text" id="admin_name" name="admin_name" class="form-control" value="{{ admin.admin_name }}" required placeholder="请输入管理员名称">
                </div>

                <!-- 新密码 -->
                <div class="form-group mb-3">
                  <label for="password" class="form-label">新密码（留空则不修改）</label>
                  <input type="password" id="password" name="password" class="form-control" value="{{ admin.password }}" placeholder="请输入新密码">
                </div>

                <!-- 操作按钮 -->
                <div class="d-flex justify-content-between">
                  <button type="submit" class="btn btn-success">保存更改</button>
                  <a href="{{ url_for('main.admin_user_management') }}" class="btn btn-outline-secondary">返回列表</a>
                </div>
              </form>
            </div>
          </div>
        </div>
      </main>
    </div>
  </div>

{% include 'admin/footer.html' %}
</body>
